package com.nebula.api.modules.member.controller;

import com.nebula.api.common.entity.TokenUser;
import com.nebula.api.modules.member.entity.CmfMember;
import com.nebula.api.modules.member.service.ICmfMemberService;
import link.ahsj.core.entitys.ApiModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("shop")
public class MemberConller {

    @Autowired
    ICmfMemberService iCmfMemberService;
    //处理获取用户信息的请求
    @GetMapping("/userProfiles")
    public ResponseEntity<ApiModel> userProfiles(TokenUser tokenUser) {
        System.out.println(tokenUser);
//        调用service层方法
        HashMap<Object, Object> userProfilesHashMap = iCmfMemberService.userProfiles(tokenUser.getUserInfo());
        return ResponseEntity.ok(ApiModel.data(userProfilesHashMap));
    }
}
